package com.itheima.dubbo.web;

import com.itheima.dubbo.UserInterFace;
import com.itheima.dubbo.pojos.User;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    @DubboReference
    UserInterFace user;

    @GetMapping("/hello")
    public String hello(String username) {
        return user.Hello(username);
    }

    @GetMapping("getById")
    public User getById(Long id) {
        User user = new User();
        user.setId(id);
        return this.user.getUser(user);
    }
}
